<?php $form = $this->beginWidget('CActiveForm'); ?>

<?php echo $form->errorSummary($model); ?>

<?php if (Yii::app()->user->isGuest || !Yii::app()->user->memberId): ?>

	<div class="row">
		<?php
		echo $form->labelEx($model, 'sender');
		$htmlOptions = array('maxlength'=>255, 'class'=>'fill');
		echo $form->textField($model, 'sender', $htmlOptions);
		echo $form->error($model, 'sender');
		?>
	</div>

	<div class="row">
		<?php
		echo $form->labelEx($model, 'contact');
		echo $form->textField($model, 'contact', $htmlOptions);
		echo $form->error($model, 'contact');
		?>
	</div>

<?php endif ?>

<div class="row">
	<?php
	echo $form->labelEx($model, 'value');
	echo $form->textArea($model, 'value', array('rows'=>6));
	echo $form->error($model, 'value');
	?>
</div>

<?php if (CCaptcha::checkRequirements()): ?>
	<div class="row">
		<?php
		$properties = array(
			'showRefreshButton'=>false,
			'clickableImage'=>true,
			'imageOptions'=>array(
				'title'=>'Klik untuk mengambil kode baru',
			),
			'captchaAction'=>'news/captcha'
		);
		$this->widget('CCaptcha', $properties);
		echo $form->labelEx($model, 'verifyCode');
		echo $form->textField($model, 'verifyCode', $htmlOptions);
		echo $form->error($model, 'verifyCode');
		?>
	</div>
<?php endif; ?>

<?php if (false && !(defined('YII_DEBUG') && YII_DEBUG)): ?>
	<div class="row">
		<?php
		$publicKey = Yii::app()->params['recaptcha']['key']['public'];
		$props = array(
			'model'=>$model,
			'attribute'=>'recaptcha',
			'theme'=>'custom',
			'language'=>'en_EN',
			'customThemeWidget'=>'recaptcha_widget',
			'publicKey'=>$publicKey,
		);
		$this->widget('application.extensions.EReCaptcha', $props);
		$label = $form->labelEx($model, 'recaptcha');
		$host = 'http://www.google.com/recaptcha/api';
		$challenge = "$host/challenge?k=$publicKey";
		$noscript = "$host/noscript?k=$publicKey";
		?>
		<div id="recaptcha_widget" style="display:none">

			<div id="recaptcha_image"></div>
			<div class="recaptcha_only_if_incorrect_sol" style="color:red">
				Incorrect please try again
			</div>

			<span class="recaptcha_only_if_image"><?php echo $label; ?></span>

			<input type="text" id="recaptcha_response_field"
				   name="recaptcha_response_field" class="fill" />

		</div>
		<script type="text/javascript"src="<?php echo $challenge; ?>">
		</script>
		<noscript>
		<iframe src="<?php echo $noscript; ?>" height="300" width="500"
				frameborder="0"></iframe>
		<br>
		<textarea name="recaptcha_challenge_field" rows="3" cols="40">
		</textarea>
		<input type="hidden" name="recaptcha_response_field"
			   value="manual_challenge">
		</noscript>
		<?php
		echo $form->error($model, 'recaptcha');
		?>
	</div>
<?php endif; ?>

<div class="row buttons">
	<?php echo CHtml::submitButton('Kirim'); ?>
</div>

<?php $this->endWidget(); ?>
